import {ApiFetch} from "../api/apiHandler";
import {BaseUrl} from "../constant/constant";

class VideoModel {

    constructor() {
        this.url = BaseUrl
        // this.url = 'http://101.200.142.211:3580/'

    }

    all(params) {
        // let end = this.url + 'houtai/getgamevideohandler'
        let end = this.url + 'getgamevideohandler'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }

    add(params, config) {
        let end = this.url + 'addgamevideo'
        let req = new ApiFetch(end)
        let fm = new FormData()
        for (let i = 0; i < Object.keys(params).length; i++) {
            let k = Object.keys(params)[i]
            let v = params[k]
            fm.append(k, v)
        }
        return req.fetch(fm, config)
            // .then((data) => console.log(data))
    }

    delete(params, config) {
        console.log(params)
        let end = this.url + 'delgamevideohandler'
        let req = new ApiFetch(end)
        return req.fetch(params)
    }
}

export default VideoModel
